package cocoaas3.nd2d{

	import flash.display.DisplayObject;
	import flash.display.BitmapData;
	import flash.geom.*;
	import flash.utils.*;

	import de.nulldesign.nd2d.display.*;
	import de.nulldesign.nd2d.materials.texture.*;

	public class UIImageView extends UIView	{

		//
		// custom
		//
		private var container:UIView = new UIView();

    	public function UIImageView( mc:DisplayObject, width:uint, height:uint ){
    		addSubview( container );

			var bd:BitmapData = new BitmapData( width, height, true, 0 );
			bd.draw( mc );
			var myTexture:Texture2D = Texture2D.textureFromBitmapData( bd );
			container.setTexture( myTexture );

			// ND2DのTexture2Dの基準点は画像の中心なので、それを戻す
			container.x = width/2;
			container.y = height/2;
		}
	}

}